<template>
	<view>
		<view style="padding: 10px 20px;">
			<uni-forms ref="form" :model="form" :rules="rules">
				<text style="font-size: 22px;font-weight: 700;margin-bottom: 20px;">提现金额</text>
				<view class="align-center" style="margin: 20px 0;">
					<text class="myicon icon-yuebao text-color" style="font-size: 16px;"></text>
					<input type="text" v-model="form.amount" style="font-size: 20px;margin-left: 15px;" placeholder="0.00">
				</view>
				<view class="justify-between" style="font-size: 14px;margin: 20px 0;">
					<view style="color: #C0C4CC;">可提现金额为<text class="text-color">{{ userInfo.money }}</text>元</view>
					<text @click="nav('/pages/opera/my/tixian_log')" class="text-color">我的提现记录</text>
				</view>
				<view class="align-center" style="margin-bottom: 20px;">
					<view class="align-center">
						<text class="myicon icon-zhifubao" style="color: #06b4fd;font-size: 26px;"></text>
						<text style="margin: 0 10px 0 5px;">支付宝</text>
						<text v-if="form.is_alipay==1" @click="form.is_alipay=0" class="myicon icon-success-filling text-color" style="font-size: 26px;"></text>
						<!-- <text style="margin: 0 10px 0 5px;">微信</text> -->
						<text v-if="form.is_alipay==0" @click="form.is_alipay=1" class="myicon icon-yuanxingweixuanzhong text-color" style="font-size: 26px;"></text>
					</view>
				</view>
				
				<uni-forms-item label="提现账号" name="account" label-width="90px">
					<uni-easyinput v-model="form.account" placeholder=" " />
				</uni-forms-item>
				<uni-forms-item label="姓名" name="name" label-width="90px">
					<uni-easyinput v-model="form.name" placeholder=" " />
				</uni-forms-item>
			
			</uni-forms>
			<view class="btn-primary" @click="submit" style="margin-top: 30px;">确认提现</view>
		</view>
		
	</view>
</template>

<script>
	export default {
		data() {
			return {
				userInfo: null,
				form:{
					is_alipay: 1,
					amount: 0,
					name: '',
					account: ''
				}
			}
		},
		onLoad() {
			this.get('user/user_info').then(({code,user_info})=>{
				if(code==1){
					this.userInfo = user_info;
				}
			})
		},
		methods: {
			submit(){
				if(this.form.amount<10){
					this.error('最低提现额为10元');return
				}
				this.post('Douyin/alipay_withdraw', this.form).then(({code, msg})=>{
					if(code == 1){
						this.success(msg);
						this.redirect('/pages/opera/my/tixian_log', 1200);
					}
				})
			}
		}
	}
</script>

<style lang="scss">

</style>
